package org.dromara.comm.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.dromara.comm.domain.AsReportManagement;
import org.dromara.comm.service.AsReportManagementService;
import org.dromara.comm.service.Impl.AsReportManagementServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 报事管理控制层
 *
 * @author: 郭伟明
 * @date: 2024-07-31 19:30
 **/
@RestController
@RequestMapping("/AsReportManagement")
@Tag(name = "报事管理")
public class AsReportManagementController {

    @Autowired
    private AsReportManagementService asReportManagementService;

    @Autowired
    private AsReportManagementServiceImpl asReportManagementServiceimpl;

    @Operation(summary = "获取社区列表")
    @GetMapping("/communityList")
    public ResponseEntity<Object> getCommunityList() {
        return new ResponseEntity<>(asReportManagementServiceimpl.communityList(), HttpStatus.OK);
    }

    @Operation(summary = "获取地理位置")
    @GetMapping("/vaccinesList")
    public ResponseEntity<Object> vaccinesList() {
        return new ResponseEntity<>(asReportManagementServiceimpl.vaccinesList(), HttpStatus.OK);
    }


    @Operation(summary = "提交租赁纠纷")
    @PostMapping("/insertReportManagement")
    public void insertReportManagement(@RequestBody AsReportManagement asReportManagement, List<String> imagePaths) {
        asReportManagementService.insertReportManagement(asReportManagement, imagePaths);
    }

    @Operation(summary = "查询办事记录")
    @GetMapping("/queryReportManagement")
    public ResponseEntity<Object> queryReportManagement(@RequestParam Integer ment) {
        return new ResponseEntity<>(asReportManagementServiceimpl.queryReportManagement(ment), HttpStatus.OK);
    }

    @Operation(summary = "取消上报")
    @PostMapping("/updateReportManagement")
    public void updateReportManagement(@RequestBody AsReportManagement asReportManagement) {
        asReportManagementService.updateReportManagement(asReportManagement);
    }

    @Operation(summary = "查询办事记录详细")
    @GetMapping("/selectReportManagement")
    public ResponseEntity<Object> selectReportManagement(AsReportManagement asReportManagement) {
        return new ResponseEntity<>(asReportManagementServiceimpl.selectReportManagement(asReportManagement), HttpStatus.OK);
    }

    @Operation(summary = "删除记录")
    @PostMapping("/deleteReportManagement")
    public void deleteReportManagement(Integer id) {
        asReportManagementService.deleteReportManagement(id);
    }
}
